import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router);

//引入自己的vue文件
const Home = r => require([ '@/components/home/home.vue'], r);
// 消息
const Forum = r => require([ '@/components/forum/forum.vue'], r);
// 我的页面
const Me = r => require([ '@/components/me/me.vue'], r);
const CreditCenter = r => require([ '@/components/me/creditCenter/creditCenter.vue'], r);
const SetUp = r => require([ '@/components/me/setUp/setUp.vue'], r);
const SpareMoney = r => require([ '@/components/me/spareMoney/spareMoney.vue'], r);
const CashDeposit = r => require([ '@/components/me/cashDeposit/cashDeposit.vue'], r);
const BidCoin = r => require([ '@/components/me/bidCoin/bidCoin.vue'], r);
const RedPackes = r => require([ '@/components/me/redPackes/redPackes.vue'], r);
const MyBid = r => require([ '@/components/me/myBid/myBid.vue'], r);
const UpdateUserinfo = r => require([ '@/components/me/updateUserinfo/updateUserinfo.vue'], r);
const MyFollow = r => require([ '@/components/me/myFollow/myFollow.vue'], r);
const FollowProduct = r => require([ '@/components/me/myFollow/followProduct/followProduct.vue'], r);
const FollowShop = r => require([ '@/components/me/myFollow/followShop/followShop.vue'], r);
const FollowSpecial = r => require([ '@/components/me/myFollow/followSpecial/followSpecial.vue'], r);
const MyHistory = r => require([ '@/components/me/myHistory/myHistory.vue'], r);
// 我的账单
const MyBill = r => require([ '@/components/me/myBill/myBill.vue'], r);
const BillDetail = r => require([ '@/components/me/myBill/billDetail/billDetail.vue'], r);
// 买家订单
const MyOrder = r => require([ '@/components/me/myOrder/myOrder.vue'], r);
const OrderDetail = r => require([ '@/components/me/myOrder/orderDetail/orderDetail.vue'], r);
const AfterService = r => require([ '@/components/me/myOrder/afterService/afterService.vue'], r);
const AfterDetail = r => require([ '@/components/me/myOrder/afterDetail/afterDetail.vue'], r);
const ReturnGoods = r => require([ '@/components/me/myOrder/returnGoods/returnGoods.vue'], r);
const Evaluate = r => require([ '@/components/me/myOrder/evaluate/evaluate.vue'], r);
const ViewEvaluate = r => require([ '@/components/me/myOrder/viewEvaluate/viewEvaluate.vue'], r);
const Express = r => require([ '@/components/me/myOrder/express/express.vue'], r);
// 卖家订单
const SellOrder = r => require([ '@/components/me/sellOrder/sellOrder.vue'], r);
const DeliverGoods = r => require([ '@/components/me/sellOrder/deliverGoods/deliverGoods.vue'], r);
const SellOrderDetail = r => require([ '@/components/me/sellOrder/sellOrderDetail/sellOrderDetail.vue'], r);
// 藏品
const Collection = r => require([ '@/components/me/collection/collection.vue'], r);
const Album = r => require([ '@/components/me/collection/album/album.vue'], r);
const AlbumDetail = r => require([ '@/components/me/collection/album/albumDetail/albumDetail.vue'], r);
const SelectPhoto = r => require([ '@/components/me/collection/album/selectPhoto/selectPhoto.vue'], r);
const Photo = r => require([ '@/components/me/collection/photo/photo.vue'], r);
const PhotoDetail = r => require([ '@/components/me/collection/photo/photoDetail/photoDetail.vue'], r);
const UploadPhoto = r => require([ '@/components/me/collection/photo/uploadPhoto/uploadPhoto.vue'], r);
// 拍品/专场/店铺列表、详情
const Product = r => require([ '@/components/product/product.vue'], r);
const ProductLots = r => require([ '@/components/product/productLots/productLots.vue'], r);
const ProductSpecial = r => require([ '@/components/product/productSpecial/productSpecial.vue'], r);
const ProductShop = r => require([ '@/components/product/productShop/productShop.vue'], r);
const SpecialDetail = r => require([ '@/components/specialDetail/specialDetail.vue'], r);
const LotDetail = r => require([ '@/components/lotDetail/lotDetail.vue'], r);
const HistoryKnowledge = r => require([ '@/components/lotDetail/historyKnowledge/historyKnowledge.vue'], r);
const ShopDetail = r => require([ '@/components/shopDetail/shopDetail.vue'], r);
const ShopCollection = r => require([ '@/components/shopDetail/shopCollection/shopCollection.vue'], r);
// 一口价提交订单/地址
const WriteOrder = r => require([ '@/components/lotDetail/writeOrder/writeOrder.vue'], r);
const AddAddress = r => require([ '@/components/lotDetail/addAddress/addAddress.vue'], r);
const AddressList = r => require([ '@/components/lotDetail/addressList/addressList.vue'], r);
// 搜索、帮助
const Search = r => require([ '@/components/search/search.vue'], r);
const SearchResult = r => require([ '@/components/searchResult/searchResult.vue'], r);
const Help = r => require([ '@/components/help/help.vue'], r);
const Question = r => require([ '@/components/help/question/question.vue'], r);
// 个人认证
const PersonAut = r => require([ '@/components/personAut/personAut.vue'], r);
const PersonAudit = r => require([ '@/components/personAut/personAudit/personAudit.vue'], r);
const PersonFail = r => require([ '@/components/personAut/personFail/personFail.vue'], r);
const AlreadyAut = r => require([ '@/components/personAut/alreadyAut/alreadyAut.vue'], r);
const IdcardInfo = r => require([ '@/components/personAut/idcardInfo/idcardInfo.vue'], r);
const BankInfo = r => require([ '@/components/personAut/bankInfo/bankInfo.vue'], r);
// 店铺认证
const ShopAut = r => require([ '@/components/shopAut/shopAut.vue'], r);
const ShopRevise = r => require([ '@/components/shopAut/shopRevise/shopRevise.vue'], r);
const ShopAudit = r => require([ '@/components/shopAut/shopAudit/shopAudit.vue'], r);
const ShopFail = r => require([ '@/components/shopAut/shopFail/shopFail.vue'], r);
// 拍品/专场发布
const Publish = r => require([ '@/components/publish/publish.vue'], r);
const PublishLot = r => require([ '@/components/publish/publishLot/publishLot.vue'], r);
const PublishSpecial = r => require([ '@/components/publish/publishSpecial/publishSpecial.vue'], r);
// 注册、登录、设置呢称、国家
const Login = r => require([ '@/components/login/login.vue'], r);
const BindPhone = r => require([ '@/components/bindPhone/bindPhone.vue'], r);
const ResetPassword = r => require([ '@/components/resetPassword/resetPassword.vue'], r);
const ChangePassword = r => require([ '@/components/changePassword/changePassword.vue'], r);
const Agreement = r => require([ '@/components/agreement/agreement.vue'], r);
const SetName = r => require([ '@/components/setName/setName.vue'], r);
const SetCountry = r => require([ '@/components/setCountry/setCountry.vue'], r);

const NewWelfare = r => require([ '@/components/newWelfare/newWelfare.vue'], r);
const LiveAuction = r => require([ '@/components/liveAuction/liveAuction.vue'], r);
const JianBao = r => require([ '@/components/jianBao/jianBao.vue'], r);
const AuctionRecord = r => require([ '@/components/auctionRecord/auctionRecord.vue'], r);

const Wait = r => require([ '@/components/wait/wait.vue'], r);



const WeChat = r => require([ '@/components/weChat/weChat.vue'], r);


// function getAbsolutePath () {
//   let path = location.pathname;
//   return path.substring(0, path.lastIndexOf('/') + 1)
// }

export default new Router({
  // mode: "history",
  // mode: "abstract",
  // base: getAbsolutePath(),
  routes: [
    {path:'/',redirect:{name:'home'}},//重定向
    {name: 'home', path: '/home', component: Home},
    {name:'product',path:'/product',redirect: '/product/productLots',component:Product,children:[
        {name:'product.productLots',path:'/product/productLots',component:ProductLots},
        {name:'product.productSpecial',path:'productSpecial',component:ProductSpecial},
        {name:'product.productShop',path:'productShop',component:ProductShop},
      ]},

    {name:'publish',path:'/publish',redirect: '/publish/publishLot',component:Publish,children:[
        {name:'publish.publishLot',path:'publishLot',meta:{requireLogin:true},component:PublishLot},
        {name:'publish.publishSpecial',path:'publishSpecial',meta:{requireLogin:true},component:PublishSpecial},
      ]},

    {name:'myFollow',path:'/me/myFollow',redirect: '/me/myFollow/followProduct',meta:{requireLogin:true},component:MyFollow,children:[
        {name:'followProduct',path:'followProduct',meta:{requireLogin:true},component:FollowProduct},
        {name:'followShop',path:'followShop',meta:{requireLogin:true},component:FollowShop},
        {name:'followSpecial',path:'followSpecial',meta:{requireLogin:true},component:FollowSpecial},
      ]},

    {name:'forum',path:'/forum',meta:{requireLogin:true},component:Forum},

    {name:'me',path:'/me',meta:{requireLogin:true},component:Me},
    {name:'creditCenter',path:'/me/creditCenter',meta:{requireLogin:true},component:CreditCenter},
    {name:'setUp',path:'/me/setUp',meta:{requireLogin:true},component:SetUp},
    {name:'spareMoney',path:'/me/spareMoney',meta:{requireLogin:true},component:SpareMoney},
    {name:'myOrder',path:'/me/myOrder',meta:{requireLogin:true},component:MyOrder},
    {name:'orderDetail',path:'/me/myOrder/orderDetail',meta:{requireLogin:true},component:OrderDetail},
    {name:'afterService',path:'/me/myOrder/afterService',meta:{requireLogin:true},component:AfterService},
    {name:'afterDetail',path:'/me/myOrder/afterDetail',meta:{requireLogin:true},component:AfterDetail},
    {name:'returnGoods',path:'/me/myOrder/returnGoods',meta:{requireLogin:true},component:ReturnGoods},
    {name:'evaluate',path:'/me/myOrder/evaluate',meta:{requireLogin:true},component:Evaluate},
    {name:'viewEvaluate',path:'/me/myOrder/viewEvaluate',meta:{requireLogin:true},component:ViewEvaluate},
    {name:'express',path:'/me/myOrder/express',meta:{requireLogin:true},component:Express},
    {name:'myHistory',path:'/me/myHistory',meta:{requireLogin:true},component:MyHistory},

    {name:'sellOrder',path:'/me/sellOrder',meta:{requireLogin:true},component:SellOrder},
    {name:'deliverGoods',path:'/me/sellOrder/deliverGoods',meta:{requireLogin:true},component:DeliverGoods},
    {name:'sellOrderDetail',path:'/me/sellOrder/sellOrderDetail',meta:{requireLogin:true},component:SellOrderDetail},

    {name:'myBill',path:'/me/myBill',meta:{requireLogin:true},component:MyBill},
    {name:'billDetail',path:'/me/myBill/billDetail',meta:{requireLogin:true},component:BillDetail},
    {name:'cashDeposit',path:'/me/cashDeposit',meta:{requireLogin:true},component:CashDeposit},
    {name:'bidCoin',path:'/me/bidCoin',meta:{requireLogin:true},component:BidCoin},
    {name:'redPackes',path:'/me/redPackes',meta:{requireLogin:true},component:RedPackes},
    {name:'myBid',path:'/me/myBid',meta:{requireLogin:true},component:MyBid},
    {name:'updateUserinfo',path:'/me/updateUserinfo',meta:{requireLogin:true},component:UpdateUserinfo},
    {name:'collection',path:'/me/collection',redirect: '/me/collection/photo',meta:{requireLogin:true},component:Collection,children:[
        {name:'collection.photo',path:'photo',meta:{requireLogin:true},component:Photo},
        {name:'collection.album',path:'album',meta:{requireLogin:true},component:Album},
      ]},
    {name:'photoDetail',path:'/me/collection/photo/photoDetail',meta:{requireLogin:true},component:PhotoDetail},
    {name:'uploadPhoto',path:'/me/collection/photo/uploadPhoto',meta:{requireLogin:true},component:UploadPhoto},
    {name:'albumDetail',path:'/me/collection/album/albumDetail',meta:{requireLogin:true},component:AlbumDetail},
    {name:'selectPhoto',path:'/me/collection/album/selectPhoto',meta:{requireLogin:true},component:SelectPhoto},

    {name:'shopDetail',path:'/shopDetail',redirect: '/shopDetail/shopLots',component:ShopDetail,children:[
        {name:'shopDetail.shopLots',path:'shopLots',component:ProductLots},
        {name:'shopDetail.shopSpecial',path:'shopSpecial',component:ProductSpecial},
        {name:'shopDetail.shopCollection',path:'shopCollection',component:ShopCollection},
      ]},
    {name:'specialDetail',path:'/specialDetail',component:SpecialDetail},

    {name:'lotDetail',path:'/lotDetail',component:LotDetail},
    {name:'historyKnowledge',path:'/lotDetail/historyKnowledge',component:HistoryKnowledge},
    {name:'writeOrder',path:'/lotDetail/writeOrder',meta:{requireLogin:true},component:WriteOrder},
    {name:'addAddress',path:'/lotDetail/addAddress',meta:{requireLogin:true},component:AddAddress},
    {name:'addressList',path:'/lotDetail/addressList',meta:{requireLogin:true},component:AddressList},


    {name:'help',path:'/help',component:Help},
    {name:'question',path:'/help/question',component:Question},
    {name:'search',path:'/search',component:Search},
    {name:'searchResult',path:'/searchResult',component:SearchResult,children:[
        {name:'searchResult.lots',path:'lots',component:ProductLots},
        {name:'searchResult.special',path:'special',component:ProductSpecial},
        {name:'searchResult.shop',path:'shop',component:ProductShop},
      ]},

    {name:'personAut',path:'/personAut',meta:{requireLogin:true},component:PersonAut},
    {name:'personAudit',path:'/personAut/personAudit',meta:{requireLogin:true},component:PersonAudit},
    {name:'personFail',path:'/personAut/personFail',meta:{requireLogin:true},component:PersonFail},
    {name:'alreadyAut',path:'/personAut/alreadyAut',meta:{requireLogin:true},component:AlreadyAut},
    {name:'idcardInfo',path:'/personAut/idcardInfo',meta:{requireLogin:true},component:IdcardInfo},
    {name:'bankInfo',path:'/personAut/bankInfo',meta:{requireLogin:true},component:BankInfo},

    {name:'shopAut',path:'/shopAut',meta:{requireLogin:true},component:ShopAut},
    {name:'shopRevise',path:'/shopAut/shopRevise',meta:{requireLogin:true},component:ShopRevise},
    {name:'shopAudit',path:'/shopAut/shopAudit',meta:{requireLogin:true},component:ShopAudit},
    {name:'shopFail',path:'/shopAut/shopFail',meta:{requireLogin:true},component:ShopFail},

    {name:'agreement',path:'/agreement',component:Agreement},
    {name:'login',path:'/login',component:Login},
    {name:'bindPhone',path:'/bindPhone',component:BindPhone},
    {name:'resetPassword',path:'/resetPassword',component:ResetPassword},
    {name:'changePassword',path:'/changePassword',component:ChangePassword},
    {name:'setName',path:'/setName',meta:{requireLogin:true},component:SetName},
    {name:'setCountry',path:'/setCountry',meta:{requireLogin:true},component:SetCountry},

    {name:'newWelfare',path:'/newWelfare',component:NewWelfare},
    {name:'liveAuction',path:'/liveAuction',component:LiveAuction},
    {name:'jianBao',path:'/jianBao',component:JianBao},
    {name:'auctionRecord',path:'/auctionRecord',component:AuctionRecord},

    {name:'wait',path:'/wait',component:Wait},

    {name:'weChat',path:'/weChat',component:WeChat},

  ]
});



